
import { publicApi } from '@/api/public'
import { ElMessage, ElMessageBox } from 'element-plus'
export default function (url, method, request, custom) {
    if (!url) { ElMessage.warning('请传入文件下载地址') }
    publicApi(url, method || 'POST', request | {},true).then(function (response) {
        let blob = new Blob([response], {
            type: "application/vnd.ms-excel;charset=utf-8",
        });
        console.log(response, 'response')
        let url = window.URL.createObjectURL(blob);
        let aLink = document.createElement("a");
        aLink.style.display = "none";
        aLink.href = url;
        aLink.setAttribute("download", custom.downName || null);
        document.body.appendChild(aLink);
        aLink.click();
        document.body.removeChild(aLink);
        window.URL.revokeObjectURL(url);
    })
}